#include "Point.h"
#include <math.h>


Point::Point(void)
{
}

Point::Point(double x, double y, double z)
{
	this->x = x;
	this->y = y;
	this->z = z;
}

Point::~Point(void)
{
}

double Point::distance(void)
{
	return sqrt(pow(x, 2) + pow(y, 2) + pow(z, 2));
}

double Point::distance(Point p)
{
	return sqrt(pow(this->x - p.getValue(Point::X), 2) + pow(this->y - p.getValue(Point::Y), 2) + pow(this->z - p.getValue(Point::Z), 2));
}

double Point::getValue(coordinate c)
{
	if(c == X) return this->x;
	else if(c == Y) return this->y;
	else if(c == Z) return this->z;
	else return -1;
}

void Point::setX(double x){
	this->x = x;
}

void Point::setY(double y){
	this->y = y;
}

void Point::setZ(double z){
	this->z = z;
}

void Point::scaling(double scaling){
	this->x = this->x * scaling;
	this->y = this->y * scaling;
	this->z = this->z * scaling;
}

void Point::cwToStandard(){
	double aux;
	aux = this->y;
	this->y = this->z;
	this->z = -aux;
}

void Point::standardToCw(){
	double aux;
	aux = this->y;
	this->y = -this->z;
	this->z = aux;
}